package com.thiswhyme.seata.account.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.thiswhyme.seata.account.domain.Account;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @author: thiswhyme
 * @date: 2020/9/4
 */
public interface AccountMapper extends BaseMapper<Account> {

    @Update("UPDATE t_account SET balance = balance - #{price} WHERE id = #{userId}")
    Integer reduceBalance(@Param("userId") Long userId, @Param("price") Integer price);
}
